require "watir"
require 'mysql'


# normal navigation of luxury page signup
browser = Watir::Browser.start "http://www.shermanstravel.com/luxury/"
browser.text_field(:id, "txtNewsletterSignupEmail").set("zhangxmbxy@xm.com")
browser.text_field(:id, "txtNewsletterSignupEmail").set("zhangxmbxy@xm.com")
browser.button(:src,"http://i.stcdn.net/btn_signmeup_light_orange.jpg").click
browser.button(:id, "btnNewsletterSignup").click
browser.button(:name, "btnNewsletterSignup").click
browser.text_field(:id, "lux_my_zip").set("10025")
browser.text_field(:id, "lux_my_zip").set("10025")
browser.text_field(:id, "lux_my_zip").set("10025")
browser.checkbox(:id, "si_1").set
browser.checkbox(:id, "si_1").set
browser.checkbox(:id, "si_1").set
browser.checkbox(:id, "si_8").set
browser.checkbox(:id, "si_8").set
browser.checkbox(:id, "si_8").set
browser.checkbox(:id, "si_13").set
browser.checkbox(:id, "si_13").set
browser.checkbox(:id, "si_13").set
browser.checkbox(:id, "si_3").set
browser.checkbox(:id, "si_3").set
browser.checkbox(:id, "si_3").set
browser.text_field(:id, "lux_first_name").set("Ximin")
browser.text_field(:id, "lux_first_name").set("Ximin")
browser.text_field(:id, "lux_first_name").set("Ximin")
browser.button(:value,"Submit").click

# check the database information
begin
  my = Mysql.new("db1.shermanstravel.com", "webuser", "0xQ!=_7R", 'st')
  res = my.excute("SELECT * FROM people where email='zhangxmbxy@hotmail.com' and last_name='Zhang' and first_name= 'ximin' ")
  res.each do |row|
      printf "First Name: %s, Last Name : %s\n", row[3], row[4]
  end
end

browser.button(:name, "luxBtnSubmit").click
browser.text_field(:name, "LastName").set("Zhang")
browser.text_field(:name, "Address2").set("219 W 100ST")
browser.text_field(:name, "City").set("NY")
browser.select_list(:name, "StOrProv").set("West Virginia")
browser.select_list(:name, "Domain").set("April")
browser.button(:value,"Submit").click